#!/usr/bin/env bash
# 将执行目录移动到 当前文件所在目录
cd `dirname $0`

# 检查配置文件
if [ ! -f 'proxy.conf' ];then
    cp proxy.conf.example proxy.conf
fi
source ./proxy.conf

CONTAINER_NAME="proxy-socks5";

docker pull xkuma/socks5
docker stop ${CONTAINER_NAME}
docker rm ${CONTAINER_NAME}
docker run -d \
    -p ${PROXY_PORT}:1080 \
    -e PROXY_USER="${PROXY_USER}" \
    -e PROXY_PASSWORD="${PROXY_PASSWORD}" \
    -e PROXY_SERVER=0.0.0.0:1080 \
    --name "${CONTAINER_NAME}" \
    --restart=on-failure:10 \
    xkuma/socks5
docker start "${CONTAINER_NAME}"

cd -
